package com.itzdm.ai.advice;

import com.itzdm.common.advice.CommonExceptionAdvice;
import com.itzdm.common.constant.MessageConstant;
import com.itzdm.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.net.ConnectException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.sql.SQLSyntaxErrorException;

@RestControllerAdvice
@Slf4j
public class AiExceptionAdvice extends CommonExceptionAdvice {



    @ExceptionHandler(ConnectException.class)
    public Result<?> handleConnectException(ConnectException e) {
        log.error("连接异常: {}", e.getMessage());
        return Result.error(MessageConstant.CONNECT_ERROR);
    }

} 